import { Router } from 'express'
import multipart from 'connect-multiparty'
import * as Profile from '../controlers/profile.js'
import { vertifyToken } from '../utils/middleware.js'

const profileRouter = Router()

const multipartMiddleware = multipart()

/**获取用户资料 */
profileRouter.get('/user', vertifyToken,Profile.getUserProfile)

/**获取用户权限 */
profileRouter.get('/perm',vertifyToken,Profile.getUserPerm)

/**修改用户信息 */
profileRouter.put('/user/update',vertifyToken,Profile.updateUserProfile)

/**修改头像 */
profileRouter.put('/user/avatar', vertifyToken,multipartMiddleware,Profile.updateUserAvatar)


export default profileRouter